WPS Office.apk(点击下载) / ndr.java


package defpackage;

/* renamed from: ndr  reason: default package */
public final class ndr {
    static final String[] pBD = new String[0];
    static final char[] pBE = {'&', 'l', 't', ';'};
    static final char[] pBF = {'&', 'g', 't', ';'};
    static final char[] pBG = {'&', 'a', 'm', 'p', ';'};
    static final char[] pBH = {'&', 'a', 'p', 'o', 's', ';'};
    static final char[] pBI = {'&', 'q', 'u', 'o', 't', ';'};
    static final char[] pBJ = {'&', '#', 'x', 'A', ';'};
    StringBuffer pBB;

    public ndr(StringBuffer stringBuffer) {
        ev.assertNotNull("content should not be null", stringBuffer);
        this.pBB = stringBuffer;
        this.pBB.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        this.pBB.append("<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">");
    }

    /* access modifiers changed from: package-private */
    public final void a(boolean z, String str, String[] strArr, int i) {
        int length;
        if (strArr == null) {
            strArr = pBD;
        }
        if (i > strArr.length) {
            i = strArr.length;
        }
        this.pBB.append('<');
        this.pBB.append(str);
        for (int i2 = 0; i2 < i; i2 += 2) {
            String str2 = strArr[i2];
            String str3 = strArr[i2 + 1];
            if (!(str2 == null || str2.length() == 0)) {
                ev.assertNotNull("value should not be null.", str3);
                this.pBB.append(' ');
                this.pBB.append(str2);
                this.pBB.append('=');
                this.pBB.append('\"');
                if (!(str3 == null || (length = str3.length()) == 0)) {
                    int i3 = 0;
                    while (i3 < length) {
                        int i4 = i3 + 1;
                        char charAt = str3.charAt(i3);
                        switch (charAt) {
                            case '\n':
                                this.pBB.append(pBJ, 0, pBJ.length);
                                i3 = i4;
                                break;
                            case ' ':
                                this.pBB.append((char) 160);
                                i3 = i4;
                                break;
                            case '\"':
                                this.pBB.append(pBI, 0, pBI.length);
                                i3 = i4;
                                break;
                            case '&':
                                this.pBB.append(pBG, 0, pBG.length);
                                i3 = i4;
                                break;
                            case '\'':
                                this.pBB.append(pBH, 0, pBH.length);
                                i3 = i4;
                                break;
                            case '<':
                                this.pBB.append(pBE, 0, pBE.length);
                                i3 = i4;
                                break;
                            case '>':
                                this.pBB.append(pBF, 0, pBF.length);
                                i3 = i4;
                                break;
                            default:
                                this.pBB.append(charAt);
                                i3 = i4;
                                break;
                        }
                    }
                }
                this.pBB.append('\"');
            }
        }
        if (z) {
            this.pBB.append('/');
            this.pBB.append('>');
            return;
        }
        this.pBB.append('>');
    }

    public final void endElement(String str) {
        this.pBB.append('<');
        this.pBB.append('/');
        this.pBB.append(str);
        this.pBB.append('>');
    }

    public final void i(String str, String... strArr) {
        a(false, str, strArr, strArr.length);
    }
}